package com.lu.statistics.service.cart;

import com.lu.statistics.entity.MtDishCategories;
import com.lu.statistics.entity.RCustomerCart;
import com.lu.statistics.entity.enums.GoodsTypeEnum;
import com.lu.statistics.mapper.RCustomerCartMapper;
import com.lu.statistics.service.CartTypeService;
import com.lu.statistics.service.DishCategoriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DishSetMenuServiceImpl implements CartTypeService {
    @Autowired
    private RCustomerCartMapper cartMapper;
    @Autowired
    private DishCategoriesService categoriesService;
    @Override
    public void addCustomerCart(RCustomerCart customerCart) {
        MtDishCategories dishCategories = categoriesService.queryDishCategoriesById(customerCart.getCategoriesId());
        customerCart.setProductName(dishCategories.getCategoryName());
        customerCart.setImgUrl(dishCategories.getImgUrl());
        customerCart.setImgName(dishCategories.getImgName());
        customerCart.setDescribes(dishCategories.getDescribes());
        customerCart.setCartStatus(0);
        customerCart.setProductType(GoodsTypeEnum.CUISINE.name());
        cartMapper.insert(customerCart);
    }

    @Override
    public String getType() {
        return GoodsTypeEnum.SET_MENU.name();
    }
}
